<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <link rel="stylesheet" href="../../lib/jq-module/zyupload/zyupload-1.0.0.min.css" media="all">
    <link rel="stylesheet" href="../../lib/yzhUpload/control/css/zyUpload.css" type="text/css">
    <style>
        body {
            background-color: #ffffff;
        }

        .zyupload {
            margin: 0;
            height: auto !important;
        }
        .aui-upload-box {
            background-color: #fff;
            width: 105px;
            height: 105px;
            padding-top: 5px;
            padding-right: 5px;
        }

        .chose_pic_btn {
            width: 95px;
            height: 95px;
            position: relative;
            display: inline-block;
            background-image: url('');
            box-sizing: border-box;
            background-size: 45px 45px;
            background-position: center center;
            background-repeat: no-repeat;
            background-color: #ededed;
            margin-left: 3.3333%;
            margin-bottom: 12px;
            border-radius: 5px;
        }

        .chose_pic_btn div {
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0;
            width: 100%;
            height: 100%;
        }

        .cancel {
            width: 20px;
            height: 20px;
            line-height: 19px;
            border: 1px solid #bcc4caf2;
            background-color: #bcc4caf2;
            border-radius: 50%;
            position: absolute; /* 父组件赋予属性relative生效 */
            right: 10px; /* 使元素处于右上角-右 */
            top: 10px; /* 使元素处于右上角-上 */
        }

        .cancel::before,
        .cancel::after {
            content: "";
            position: absolute;
            height: 14px;
            width: 2px;
            top: 3px; /* 使X处于圆中心 */
            left: 9px; /* 使X处于圆中心 */
            background-color: #353535;
        }

        .cancel::before {
            transform: rotate(45deg);
        }

        .cancel::after {
            transform: rotate(-45deg);
        }

    </style>
</head>
<body>
<div class="layui-form" lay-filter="customer-form">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>基本信息</legend>
    </fieldset>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">注册时间</label>
        <div class="layui-input-block">
            <input type="text" name="createTime" readonly value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">用户头像</label>
        <div class="layui-input-block">
            <div class="layui-upload">
                <div class="aui-upload-box">
                    <div class="aui-upload-pic">
					<span class="chose_pic_btn" id="avatarImage">
						<div>
                        </div>
					</span>
                    </div>
                </div>
                <p id="errText"></p>
                <button type="button" class="layui-btn" id="upload-avatar-image">上传图片</button>
            </div>
            <input type="text" style="display: none" name="avatarUrl" placeholder="请输入头像链接"
                   value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text" style="display: none">
        <label class="layui-form-label">ID</label>
        <div class="layui-input-block">
            <input type="text" name="customerId" lay-verify="required" readonly value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label required">平台ID</label>
        <div class="layui-input-block">
            <input type="text" name="userId" readonly lay-verify="required" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">平台昵称</label>
        <div class="layui-input-block">
            <input type="text" name="userName" value="" class="layui-input">
        </div>
    </div>
    <!--<div class="layui-form-item layui-form-text">-->
    <!--    <label class="layui-form-label">平台身份</label>-->
    <!--    <div class="layui-input-block">-->
    <!--        <input type="text" name="platformIdentity" readonly value="" class="layui-input">-->
    <!--    </div>-->
    <!--</div>-->
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">关联手机</label>
        <div class="layui-input-block">
            <input type="text" name="phoneNumber" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" name="realName" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="text" name="sex" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">年龄层</label>
        <div class="layui-input-block">
            <input type="text" name="ageGroup" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">个人介绍</label>
        <div class="layui-input-block">
            <textarea placeholder="请填写用户个人介绍" class="layui-textarea" name="introduction"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">所在地区</label>
        <div class="layui-input-block">
            <input type="text" name="region" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">所在街道</label>
        <div class="layui-input-block">
            <input type="text" name="streetVillage" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">个人身份</label>
        <div class="layui-input-block">
            <input type="text" name="identityJob" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">月收入</label>
        <div class="layui-input-block">
            <input type="text" name="monthlyIncome" value="" class="layui-input">
        </div>
    </div>
    <!--<div class="layui-form-item layui-form-text">-->
    <!--    <label class="layui-form-label">绑定公众号</label>-->
    <!--    <div class="layui-input-block">-->
    <!--        <select name="isSubscribed" lay-filter="isSubscribed">-->
    <!--            <option value="1">是</option>-->
    <!--            <option value="0">否</option>-->
    <!--        </select>-->
    <!--    </div>-->
    <!--</div>-->
    <div id="platform_identity_info">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>平台工作者身份</legend>
        </fieldset>
        <div class="layui-collapse" lay-filter="infoPanel">
            <div class="layui-colla-item" id="REGIONAL_SERVICE_PROVIDERS">
                <h2 class="layui-colla-title">区域服务商</h2>
                <div class="layui-colla-content">
                    <div class="layui-form-item layui-form-text" style="display: none">
                        <label class="layui-form-label">区域服务商Id</label>
                        <div class="layui-input-block">
                            <input type="text" name="providerPersonId" value=""
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">店铺名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="storeName" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">店铺类型</label>
                        <div class="layui-input-block">
                            <select name="storeType">
                                <option value="">请选择</option>
                                <option value="便利店">便利店</option>
                                <option value="菜鸟驿站">菜鸟驿站</option>
                                <option value="团购点">团购点</option>
                                <option value="餐饮">餐饮</option>
                                <option value="其他店铺">其他店铺</option>
                                <option value="个人">个人</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">区域编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="providerId" readonly value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">所在地区</label>
                        <div class="layui-input-block">
                            <input type="text" name="area" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">所在街道</label>
                        <div class="layui-input-block">
                            <input type="text" name="street" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">店铺头像</label>
                        <div class="layui-input-block">
                            <div style="display: flex;flex-wrap: wrap">
                                <div id="ad-images" style="display: flex;flex-wrap: wrap"></div>
                                <div class="aui-upload-box" onclick="addPic()">
                                    <div class="aui-upload-pic">
                                        <span class="chose_pic_btn">
                                            <div></div>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div id="zy-upload" class="zyupload"></div>
                            <input type="text" name="storeAvatar" value="" hidden>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-colla-item" id="EVALUATOR">
                <h2 class="layui-colla-title">玫丽测评师</h2>
                <div class="layui-colla-content">
                    <div class="layui-form-item layui-form-text" style="display: none">
                        <label class="layui-form-label">测评师Id</label>
                        <div class="layui-input-block">
                            <input type="text" name="evaluatorPeopleId" value=""
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">测评喜好</label>
                        <div class="layui-input-block">
                            <input type="text" name="evaluationLikes" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text" style="display: none">
                        <label class="layui-form-label">测评喜好主</label>
                        <div class="layui-input-block">
                            <input type="text" name="mainCategory" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text" style="display: none">
                        <label class="layui-form-label">测评喜好副</label>
                        <div class="layui-input-block">
                            <input type="text" name="secondCategory" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">兴趣领域</label>
                        <div class="layui-input-block">
                            <input type="text" name="interests" value="" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">抖音平台</label>
                            <div class="layui-input-inline">
                                <select name="tiktok" lay-filter="tiktok">
                                    <option value="有">有</option>
                                    <option value="无">无</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">粉丝数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="tiktokFans" value="" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">获赞数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="tiktokLikes" value="" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">小红书平台</label>
                            <div class="layui-input-inline">
                                <select name="littleRedBook" lay-filter="littleRedBook">
                                    <option value="有">有</option>
                                    <option value="无">无</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">粉丝数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="littleRedBookFans" value="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label"> 获赞与收藏数</label>
                            <div class="layui-input-inline">
                                <input type="text" name="littleRedBookLikes" value="" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">其他平台</label>
                            <div class="layui-input-inline">
                                <input type="text" name="otherPlatforms" value="" class="layui-input">
                            </div>
                        </div>

                        <!--<div class="layui-inline">-->
                        <!--    <label class="layui-form-label">测评师等级</label>-->
                        <!--    <div class="layui-input-inline">-->
                        <!--        <select name="evaluationGrade" lay-filter="evaluationGrade">-->
                        <!--            <option value="A">A</option>-->
                        <!--            <option value="B">B</option>-->
                        <!--            <option value="C">C</option>-->
                        <!--            <option value="F">F</option>-->
                        <!--        </select>-->
                        <!--    </div>-->
                        <!--</div>-->

                        <!--<div class="layui-inline">-->
                        <!--    <label class="layui-form-label"></label>-->
                        <!--    <div class="layui-input-inline">-->
                        <!--        <input type="checkbox" name="willingDistribute" lay-skin="primary"-->
                        <!--               title="是否愿意为平台分销商品赚取佣金" value="是"-->
                        <!--               checked="">-->
                        <!--    </div>-->
                        <!--</div>-->
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">测评师等级</label>
                            <div class="layui-input-inline">
                                <select name="evaluationGrade" lay-filter="evaluationGrade">
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="F">F</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top: 20px;" id="saveBtn">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn" lay-submit lay-filter="saveBtn">确认修改</button>
        </div>
    </div>


</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../../lib/common/common.js" charset="utf-8"></script>
<script src="../../lib/common/permissions.js" charset="utf-8"></script>
<script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<!--图片上传-->
<script src="https://unpkg.com/cos-js-sdk-v5/dist/cos-js-sdk-v5.min.js"></script>
<script type="text/javascript" src="../../lib/yzhUpload/core/zyFile.js"></script>
<script type="text/javascript" src="../../lib/yzhUpload/control/js/zyUpload.js"></script>
<script>

    window.onload = function () {
        let id = GetQueryString("id");
        if (isNotNull(id)) {
            init(id);
            // 初始化插件
            $("#zy-upload").zyUpload({
                width: "650px",                 // 宽度
                height: "400px",                 // 宽度
                itemWidth: "120px",                 // 文件项的宽度
                itemHeight: "100px",                 // 文件项的高度
                url: "/upload/UploadAction",  // 上传文件的路径
                multiple: true,                    // 是否可以多个文件上传
                dragDrop: true,                    // 是否可以拖动上传文件
                del: true,                    // 是否可以删除文件
                finishDel: false,  				  // 是否在上传文件完成后删除预览
                /* 外部获得的回调接口 */
                onSelect: function (files, allFiles) {                    // 选择文件的回调方法
                    console.info("当前选择了以下文件：");
                    console.info(files);
                    console.info("之前没上传的文件：");
                    console.info(allFiles);
                },
                onDelete: function (file, surplusFiles) {                     // 删除一个文件的回调方法
                    console.info("当前删除了此文件：");
                    console.info(file);
                    console.info("当前剩余的文件：");
                    console.info(surplusFiles);
                },
                onSuccess: function (file, response) {                    // 文件上传成功的回调方法
                    console.info("此文件上传成功：");
                    if (isNotNull(response.url)) {
                        uploadAddToImg(response.url);
                    }
                },
                onFailure: function (file) {                    // 文件上传失败的回调方法
                    console.info("此文件上传失败：");
                    console.info(file);
                },
                onComplete: function (responseInfo) {           // 上传完成的回调方法
                    console.info("文件上传完成");
                    console.info(responseInfo);
                }
            });
        } else {
            setTimeout(function () {
                layer.msg("数据异常，请联系系统管理员");
                let iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(iframeIndex);
            }, 1500);
        }
    }

    // 头像
    layui.use(['layer', 'form'], function () {
        const form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            upload = layui.upload,
            laydate = layui.laydate;

        //常规使用 - 普通图片上传
        let uploadInst = upload.render({
            elem: '#upload-avatar-image'
            , url: '/meily/upload'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#avatarImage').css({
                        'background-image': 'url(' + result + ')',
                        'background-size': '100% 100%'
                    }); //图片链接（base64）
                });
                layer.msg('上传中', {icon: 16, time: 0});
            }
            , done: function (res) {
                //如果上传失败
                if (res.code !== '200') {
                    return layer.msg('上传失败');
                }
                //上传成功的一些操作
                $('input[name="avatarUrl"]').val(res.url);
                $('#errText').html(''); //置空上传失败的状态
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#errText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs upload-reload">重试</a>');
                demoText.find('.upload-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
            //进度条
            , progress: function (n, elem, e) {
                if (n == 100) {
                    layer.msg('上传完毕', {icon: 1});
                }
            }
        });
    });

    /**
     * 初始化数据
     */
    function init(id) {
        $.ajax({
            type: "GET",
            url: `/customer/info/${id}`,
            dataType: 'json',
            contentType: 'application/x-www-form-urlencoded',
            success: function (req) {
                if (req.code === '200') {
                    layui.use(['form'], function () {
                        let $ = layui.jquery,
                            form = layui.form;
                        form.render();
                        const {customerBasicInfoDTO, evaluatorPeopleBasicInfoDTO, providerDTO} = req.data;
                        if (!evaluatorPeopleBasicInfoDTO && !providerDTO) {
                            document.getElementById("platform_identity_info").style.display = 'none'
                        }
                        if (!evaluatorPeopleBasicInfoDTO) {
                            document.getElementById("EVALUATOR").style.display = 'none'
                        }
                        if (!providerDTO) {
                            document.getElementById("REGIONAL_SERVICE_PROVIDERS").style.display = 'none'
                        }
                        let introduction = customerBasicInfoDTO.introduction;
                        if (!isNotNull(introduction)){
                            if (!providerDTO) {
                                introduction = '刚成为平台的区域服务商，请多多指教～'
                            }
                            if (!evaluatorPeopleBasicInfoDTO) {
                                introduction = '刚成为玫丽测评师，请多多指教～'
                            }
                            if (!isNotNull(introduction)){
                                introduction = '刚注册平台，小白一名，请多多指教～'
                            }
                        }
                        form.val('customer-form', {
                            "customerId": customerBasicInfoDTO?.id,
                            "evaluatorPeopleId": customerBasicInfoDTO?.evaluatorId,
                            "providerPersonId": customerBasicInfoDTO?.providerId,
                            "avatarUrl": customerBasicInfoDTO?.avatarUrl,
                            "userId": customerBasicInfoDTO?.userId,
                            "platformIdentity": customerBasicInfoDTO?.platformIdentity,
                            "createTime": customerBasicInfoDTO?.createTime,
                            "isSubscribed": customerBasicInfoDTO.isSubscribed,
                            "introduction": introduction,
                            "userName": customerBasicInfoDTO?.userName,
                            "realName": customerBasicInfoDTO?.realName,
                            "sex": customerBasicInfoDTO?.sex,
                            "ageGroup": customerBasicInfoDTO?.ageGroup,
                            "identityJob": customerBasicInfoDTO?.identityJob,
                            "phoneNumber": customerBasicInfoDTO?.phoneNumber,
                            "monthlyIncome": customerBasicInfoDTO?.monthlyIncome,
                            "streetVillage": customerBasicInfoDTO?.streetVillage,
                            "region": customerBasicInfoDTO?.region,
                            "address": customerBasicInfoDTO?.address,
                            "evaluationLikes": evaluatorPeopleBasicInfoDTO?.mainCategory ? evaluatorPeopleBasicInfoDTO?.mainCategory + '(主)' + evaluatorPeopleBasicInfoDTO?.secondCategory + '(副)' : '',
                            "mainCategory": evaluatorPeopleBasicInfoDTO?.mainCategory,
                            "secondCategory": evaluatorPeopleBasicInfoDTO?.secondCategory,
                            "interests": evaluatorPeopleBasicInfoDTO?.interests,
                            "tiktok": evaluatorPeopleBasicInfoDTO?.tiktok,
                            "tiktokFans": evaluatorPeopleBasicInfoDTO?.tiktokFans,
                            "tiktokLikes": evaluatorPeopleBasicInfoDTO?.tiktokLikes,
                            "littleRedBook": evaluatorPeopleBasicInfoDTO?.littleRedBook,
                            "littleRedBookFans": evaluatorPeopleBasicInfoDTO?.littleRedBookFans,
                            "littleRedBookLikes": evaluatorPeopleBasicInfoDTO?.littleRedBookLikes,
                            "otherPlatforms": evaluatorPeopleBasicInfoDTO?.otherPlatforms,
                            "evaluationGrade": evaluatorPeopleBasicInfoDTO?.evaluationGrade,
                            "willingDistribute": evaluatorPeopleBasicInfoDTO?.willingDistribute === '是',
                            "storeName": providerDTO?.storeName,
                            "providerId": providerDTO?.providerId,
                            'storeType': providerDTO?.storeType,
                            "area": providerDTO?.area,
                            "street": providerDTO?.street,
                            "storeAvatar": providerDTO?.storeAvatar
                        });
                        if (isNotNull(req.data.customerBasicInfoDTO.avatarUrl)) {
                            $('#avatarImage').css({
                                'background-image': 'url(' + req.data.customerBasicInfoDTO.avatarUrl + ')',
                                'background-size': '100% 100%'
                            }); //图片链接（base64）
                        }
                        uploadAddToImg(providerDTO?.storeAvatar)
                    })
                } else {
                    setTimeout(function () {
                        layer.msg(req.msg);
                        let iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);
                    }, 1500);
                }
            },
            error: function (e) {
                setTimeout(function () {
                    layer.msg("数据异常，请联系系统管理员");
                    let iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                }, 1500);
            }
        })
    }

    /**
     * 权限判断
     * */
    const btnRoles = {
        "saveBtn": 'admin',
    }
    buttonPermissions(btnRoles)

    layui.use(['dropdown', 'util', 'layer', 'form'], function () {
        let element = layui.element,
            form = layui.form,
            $ = layui.jquery,
            layer = layui.layer;

        //监听折叠
        element.on('collapse(infoPanel)', function (data) {
            var panelId = $(this).parents('.layui-colla-item').attr('id');
            if (data.show) {
                console.log(panelId)
            }
        });

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            let index = layer.alert("确定提交吗？", {
                title: '提示'
            }, function () {
                let myMsg = layer.msg("正在提交...", {
                    icon: 16,
                    time: -1
                })
                // 组装参数
                let requestData = {
                    customerBasicInfoDTO: {
                        "id": data.field?.customerId,
                        "isSubscribed": data.field.isSubscribed,
                        "userName": data.field?.userName,
                        "realName": data.field?.realName,
                        "avatarUrl": data.field?.avatarUrl,
                        "sex": data.field?.sex,
                        "ageGroup": data.field?.ageGroup,
                        "introduction": data.field?.introduction,
                        "identityJob": data.field?.identityJob,
                        "phoneNumber": data.field?.phoneNumber,
                        "monthlyIncome": data.field?.monthlyIncome,
                        "streetVillage": data.field?.streetVillage,
                        "region": data.field?.region,
                        "address": data.field?.address,
                    },
                    evaluatorPeopleBasicInfoDTO: {
                        "id": data.field?.evaluatorPeopleId,
                        "mainCategory": data.field?.mainCategory,
                        "secondCategory": data.field?.secondCategory,
                        "interests": data.field?.interests,
                        "tiktok": data.field?.tiktok,
                        "tiktokFans": data.field?.tiktokFans,
                        "tiktokLikes": data.field?.tiktokLikes,
                        "littleRedBook": data.field?.littleRedBook,
                        "littleRedBookFans": data.field?.littleRedBookFans,
                        "littleRedBookLikes": data.field?.littleRedBookLikes,
                        "otherPlatforms": data.field?.otherPlatforms,
                        "evaluationGrade": data.field?.evaluationGrade,
                        "willingDistribute": data.field?.willingDistribute ?? '否',
                    },
                    providerDTO: {
                        "id": data.field?.providerPersonId,
                        "storeName": data.field?.storeName,
                        "storeType": data.field?.storeType,
                        "providerId": data.field?.providerId,
                        "area": data.field?.area,
                        "street": data.field?.street,
                        "storeAvatar": data.field?.storeAvatar
                    }
                }
                $.ajax({
                    type: "post",
                    url: '/customer/update/customer',
                    data: JSON.stringify(requestData),
                    dataType: 'json',
                    contentType: 'application/json; charset=UTF-8',
                    success: function (req) {
                        if (req.code === '200') {
                            layer.msg("已完成");
                            layer.close(index);
                            // 关闭弹出层
                            setTimeout(function () {
                                layer.close(myMsg);//手动关闭
                                let iframeIndex = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(iframeIndex);
                                // 调用父页面的方法
                                let parentWindow = window.parent;
                                parentWindow.reloadTable();
                            }, 1500);
                        } else {
                            layer.msg(req.msg);
                        }

                    },
                    error: function (e) {
                        layer.msg("添加失败");
                        layer.close(myMsg);//手动关闭
                    }
                })

            });

            return false;
        });
    });


    /**
     * 上传文件完成后将文件地址添加到图片列表中
     * @param url
     */
    function uploadAddToImg(url) {
        if (isNotNull(url)) {
            // 只能保留一个图片
            let storeAvatarImage = url;
            $('input[name="storeAvatar"]').val(storeAvatarImage);
            renderImages(storeAvatarImage);
        }
    }

    /**
     * 渲染加载的图片
     */
    function renderImages(imageLinks) {
        $("#ad-images").html("");
        if (!isNotNull(imageLinks)) return;
        let html = '';
        let imgs_arr = imageLinks.split(",");
        if (imgs_arr.length > 0) {
            for (const i in imgs_arr) {
                html += '<div style="padding: 5px 10px 15px 0px;position: relative;width: 95px;height: 95px;">' +
                    '                <img width="95px" height="95px" src="' + imgs_arr[i] + '"></img>' +
                    '                <span class="cancel" onclick="delImage(' + i + ')"></span>' +
                    '            </div>';
            }
        }
        $("#ad-images").html(html);
    }

    /**
     * 删除图片
     */
    function delImage(index) {
        let image_val = $('input[name="storeAvatar"]').val();
        let new_image_val = '';
        if (isNotNull(image_val)) {
            let imgs_arr = image_val.split(",");
            if (imgs_arr.length > 0) {
                for (const i in imgs_arr) {
                    if (i == index) {
                        continue;
                    }
                    if (isNotNull(new_image_val)) {
                        new_image_val += "," + imgs_arr[i];
                    } else {
                        new_image_val = imgs_arr[i];
                    }
                }
            }
        }
        $('input[name="storeAvatar"]').val(new_image_val);
        renderImages(new_image_val);
    }

</script>
</body>
</html>